load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "pump_client",
    srcs = [
        "client.go",
        "pump.go",
        "selector.go",
    ],
    importpath = "github.com/pingcap/tidb/pkg/tidb-binlog/pump_client",
    visibility = ["//visibility:public"],
    deps = [
        "//pkg/tidb-binlog/node",
        "//pkg/util",
        "//pkg/util/etcd",
        "@com_github_pingcap_errors//:errors",
        "@com_github_pingcap_log//:log",
        "@com_github_pingcap_tipb//go-binlog",
        "@com_github_tikv_pd_client//:client",
        "@io_etcd_go_etcd_api_v3//mvccpb",
        "@org_golang_google_grpc//:grpc",
        "@org_golang_google_grpc//codes",
        "@org_golang_google_grpc//credentials",
        "@org_golang_google_grpc//credentials/insecure",
        "@org_golang_google_grpc//status",
        "@org_uber_go_zap//:zap",
    ],
)

go_test(
    name = "pump_client_test",
    timeout = "short",
    srcs = [
        "bench_test.go",
        "client_test.go",
    ],
    embed = [":pump_client"],
    flaky = True,
    deps = [
        "//pkg/tidb-binlog/node",
        "@com_github_pingcap_errors//:errors",
        "@com_github_pingcap_tipb//go-binlog",
        "@com_github_stretchr_testify//require",
        "@org_golang_google_grpc//:grpc",
        "@org_golang_google_grpc//credentials/insecure",
    ],
)
